home *** CD-ROM | disk | FTP | other *** search
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` 3D Sprites
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` By Rich Davey (rich@fatal-design.com)
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` Music listened to while coding this
- ` The Mind of Goa (various artists)
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` Note:
- `
- ` My own personal testing gave the following results on a Pentium3-450
- ` with 128Megs of RAM and a GeForce 256 Pro graphics card
- `
- ` 175 64x64 sprites at 75 fps
- ` 350 32x32 sprites at 75 fps
- ` 525 16x16 sprites at 75 fps
- `
- ` Change the stars value below for maximum effect!
- ` Gain extra speed by turning the print command off.
-
- sync rate 0
- sync on
- hide mouse
-
- randomize 1000
-
- load image "bubble_64x64.bmp",1
- `load image "bubble_32x32.bmp",1
- `load image "bubble_16x16.bmp",1
-
- stars=150
-
- dim x#(stars)
- dim y#(stars)
-
- for i = 1 to stars
- x#(i)=rnd(640.0)-320.0
- y#(i)=rnd(480.0)-240.0
- sprite i,x#,y#,1
- set sprite i,0,1
- next i
-
- sx#=1.03985 : sy#=1.03985
- slidex#=320.0 : slidey#=240.0
-
- ink rgb(255,255,255),0
-
- do
-
- cls 0
-
- for j=1 to stars
- sprite j,x#(j)+slidex#,y#(j)+slidey#,1
- x#(j)=x#(j)*sx#
- y#(j)=y#(j)*sy#
- if x#(j) > 640.0 then x#(j)=x#(j)-640.0
- if y#(j) > 480.0 then y#(j)=y#(j)-480.0
- if x#(j) < -640.0 then x#(j)=x#(j)+640.0
- if y#(j) < -480.0 then y#(j)=y#(j)+480.0
- next j
-
- set cursor 0,0 : print "FPS ", screen fps()
- set cursor 0,12 : print "SPRITES ", stars
-
- sync
-
- loop
-
-